import {createRouter, createWebHashHistory} from "vue-router";

export default createRouter({   // 替代之前的 new Router()
    history: createWebHashHistory(),  // 替代之前的 mode，这里使用的是hash模式
    routes: [
        {
            path: '/',
            component: () => import("@/views/customer/index.vue")
        },
        {
            path: '/index',
            component: () => import("@/views/customer/index.vue")
        },
        {
            path: '/login',
            component: () => import("@/views/customer/login.vue")
        },
        {
            path: '/register',
            component: () => import("@/views/customer/register.vue")
        },
        {
            path: '/UltraAce',
            component: () => import("@/views/customer/UltraAce.vue")
        },
        {
            path: '/Ultraman',
            component: () => import("@/views/member/Ultraman.vue")
        },
        {
            path: '/Ultramanleo',
            component: () => import("@/views/member/Ultramanleo.vue")
        },
        {
            path: '/Ultramantaro',
            component: () => import("@/views/member/Ultramantaro.vue")
        },
        {
            path: '/Ultramantiga',
            component: () => import("@/views/member/Ultramantiga.vue")
        },
        {
            path: '/admin',
            component: () => import("@/views/admin/cowry.vue")
        },
    ],
    scrollBehavior(to, from, savedPosition) {
        if (savedPosition) {
            return savedPosition;
        } else {
            return {top: 0};  // 以前的x改成left，y改成top
        }
    }
});
